//import com.cos.mb2.dao.DeptDao;
//import com.cos.mb2.dao.EmpDao;
//import com.cos.mb2.dao.ProjectDao;
//import com.cos.mb2.entity.Dept;
//import com.cos.mb2.entity.Emp;
//import com.cos.mb2.entity.Project;
//import com.cos.mb2.util.MybatisUtils;
//import org.apache.ibatis.session.SqlSession;
//import org.junit.Test;
//
//import java.util.Date;
//import java.util.List;
//
///**
// * @author: COS
// * @time: 2022/5/31 11:19
// * @description:
// */
//public class Demo2 {
//
//    @Test
//    public void t3(){
////        DeptDao mapper = MybatisUtils.getMapper(DeptDao.class);
////        Dept deptWithEmp = mapper.getDeptWithEmp(103);
////
////        System.out.println(deptWithEmp.getDname());
////        System.out.println("这个部门下的员工名单");
////        List<Emp> empList = deptWithEmp.getEmpList();
////        for (Emp emp : empList) {
////            System.out.println(emp);
////        }
//
//        EmpDao mapper = MybatisUtils.getMapper(EmpDao.class);
//
//        List<Emp> emp = mapper.getEmpWithPro();
//        for (Emp emp1 : emp) {
//            System.out.println("员工名:"+emp1.getEname());
//            System.out.println("他负责的项目是:");
//            List<Project> proList = emp1.getProList();
//            for (Project project : proList) {
//                System.out.println(project);
//            }
//        }
//
//    }
//
//    @Test
//    public void t2(){
//        ProjectDao mapper = MybatisUtils.getMapper(ProjectDao.class);
//
////        System.out.println(mapper.getAll());
//
//        EmpDao mapper1 = MybatisUtils.getMapper(EmpDao.class);
//
//        List<Emp> emps = mapper1.getEmpWithDept(102);
//
//        for (Emp emp : emps) {
//            System.out.println("ename:"+emp.getEname()+",dname:"+emp.getD().getDname());
//
//        }
//
//
//    }
//
//
//
//    @Test
//    public void t1(){
//
////        SqlSession session = MybatisUtils.getSession();
////        EmpDao mapper = session.getMapper(EmpDao.class);
////        System.out.println(mapper.getEmpByKeyWord("3"));
//
////        Emp emp = new Emp("小奥", "妖", 9999999D, "11111",
////                new Date(), 103);
////
////        System.out.println(mapper.addEmp(emp));
////        MybatisUtils.commit();
//
//
//        System.out.println(MybatisUtils.getMapper(EmpDao.class).getEmpByKeyWord("张"));
//        System.out.println("=====");
//        System.out.println("=====");
//        System.out.println("=====");
//        System.out.println("=====");
//        System.out.println("=====");
//        System.out.println("=====");
//        System.out.println(MybatisUtils.getMapper(DeptDao.class).getAll());
//    }
//
//
//}
